#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void)
{
    pid_t id=fork();
    if(id==0)
    {
        for(int i=0;i<10;i++)
        {
            printf("child-pid:%d,ppid:%d\n",getpid(),getppid());
            sleep(1);
        }
        exit(0);
    }
    else if(id>0)
    {
        printf("father-pid:%d,ppid:%d\n",getpid(),getppid());

        pid_t ret=wait(NULL);
        if(ret>=0)
        {
            printf("Process wait succeeded,ret=%d\n",ret);
        }
        printf("father running.....\n");
        sleep(10);
    }
    return 0;
}
